package com.epam.tcs.dao.hibernate.entities;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import java.io.Serializable;
import java.util.Date;

@Entity
@Table(name = "tcs_journal_lectures")
public class JournalLectureStatus implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 3144597602556278925L;
	private Long journal_lecture_status_id;
	private Date date;

	private Lecture lecture;
	private LectureStatus lectureStatus;
	private Student student;

	public JournalLectureStatus(){}
	
	public JournalLectureStatus(Date date, Lecture lecture,
			LectureStatus lectureStatus, Student student) {
		this.date = date;
		this.lecture = lecture;
		this.lectureStatus = lectureStatus;
		this.student = student;
	}

	@Id
	@Column(name = "journal_lecture_status_id")
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getJournal_lecture_status_id() {
		return journal_lecture_status_id;
	}

	public void setJournal_lecture_status_id(Long journal_lecture_status_id) {
		this.journal_lecture_status_id = journal_lecture_status_id;
	}

	// ���� ������
	@Column(name = "date")
	@Temporal(value = TemporalType.TIMESTAMP)
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

//	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinColumn(name = "lec_prac_id", nullable = false)
	public Lecture getLecture() {
		return lecture;
	}

	public void setLecture(Lecture lecture) {
		this.lecture = lecture;
	}

//	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinColumn(name = "student_lecture_status", nullable = false)
	public LectureStatus getLectureStatus() {
		return lectureStatus;
	}

	public void setLectureStatus(LectureStatus lectureStatus) {
		this.lectureStatus = lectureStatus;
	}

//	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinColumn(name = "student_id", nullable = false)
	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

}
